#define  _CRT_SECURE_NO_WARNINGS 1

#include "game.h"

//打印菜单
void menu()
{
	printf("*****************************\n");
	printf("******** 1. 开始游戏 ********\n");
	printf("*****************************\n");
	printf("******** 0. 退出游戏 ********\n");
	printf("*****************************\n");
}

void game()
{
	//创建两个11*11的二维字符数组
	char mine[ROWS][COLS] = { 0 };//储存雷的信息
	char show[ROWS][COLS] = { 0 };//排查雷
	//初始化数组
	InitBoard(mine, ROWS, COLS, '0');
	InitBoard(show, ROWS, COLS, '*');
	//打印数组
	//DisplayBoard(mine, ROW, COL);
	DisplayBoard(show, ROW, COL);
	//布置雷
	SetMine(mine, ROW, COL);
	//DisplayBoard(mine, ROW, COL);
	//排查雷
	FindBoard(mine, show, ROW, COL);
}

int main()
{
	srand((unsigned int)time(NULL));
	int input = 0;
	do
	{
		menu();
		printf("请选择->");
		scanf("%d", &input);
		switch (input)
		{
		case 1:
			game();
			break;
		case 0:
			printf("游戏结束");
			break;
		default:
			break;
		}
	} while (input);
	return 0;
}